//
//  accountView.m
//  zhangGuangTianXia
//
//  Created by tangtangchitangtang on 2017/11/8.
//  Copyright © 2017年 tangtangchitangtang. All rights reserved.
//

#import "accountView.h"
#import "updatePasswordViewController.h"

@implementation accountView

-(void)creatView{
    self.backgroundColor=_LightGrey;
    [self creatUserView];
    [self creatUpdateView];
}
-(void)creatUserView{
    UIView *userView=[UIView new];
    [self addSubview:userView];
    [userView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.mas_equalTo(0);
        make.top.mas_equalTo(64);
        make.height.mas_equalTo(152);
    }];
    userView.backgroundColor=[UIColor whiteColor];
    
    NSArray *nameArr=[NSArray arrayWithObjects:@"昵称",@"ID号",@"手机号", nil];
    NSArray *nameArr2=[NSArray arrayWithObjects:@"未知火星用户",@"0000123901",@"123****8910", nil];
    
    for (int i=0; i<3; i++) {
        UIView *view=[UIView new];
        [userView addSubview:view];
        [view mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.right.mas_equalTo(0);
            make.height.mas_equalTo(50);
            make.top.mas_equalTo(i*51);
        }];
        
        UILabel *label=[UILabel new];
        [view addSubview:label];
        [label mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.mas_equalTo(15);
            make.centerY.mas_equalTo(0);
        }];
        label.text=nameArr[i];
        label.textColor=ColorWithRGB(49, 49, 49);
        label.font=[UIFont systemFontOfSize:18];
        
        UILabel *label2=[UILabel new];
        [view addSubview:label2];
        [label2 mas_makeConstraints:^(MASConstraintMaker *make) {
            make.right.mas_equalTo(-15);
            make.centerY.mas_equalTo(0);
        }];
        label2.text=nameArr2[i];
        label2.textColor=ColorWithRGB(150, 150, 150);
        label2.font=[UIFont systemFontOfSize:15];
        
        if (i!=2) {
            UIView *xianView=[UIView new];
            [view addSubview:xianView];
            [xianView mas_makeConstraints:^(MASConstraintMaker *make) {
                make.left.mas_equalTo(15);
                make.right.mas_equalTo(0);
                make.top.mas_equalTo(view.mas_bottom);
                make.height.mas_equalTo(1);
            }];
            xianView.backgroundColor=_LightGrey;
        }
        
    }


}
-(void)creatUpdateView{

    UIView *view=[UIView new];
    [self addSubview:view];
    [view mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.mas_equalTo(0);
        make.top.mas_equalTo(226);
        make.height.mas_equalTo(50);
    }];
    view.backgroundColor=[UIColor whiteColor];
    
    UILabel *label=[UILabel new];
    [view addSubview:label];
    [label mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(15);
        make.centerY.mas_equalTo(0);
    }];
    label.text=@"修改密码";
    label.textColor=ColorWithRGB(49, 49, 49);
    label.font=[UIFont systemFontOfSize:18];

    view.userInteractionEnabled=YES;
    UITapGestureRecognizer *pushToOther = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(pushToPassword:)];
    [view addGestureRecognizer:pushToOther];
}

-(void)pushToPassword:(UITapGestureRecognizer *)tap{
    updatePasswordViewController *Password=[updatePasswordViewController alloc];
    [ZQTools pushNextViewController:self.viewController andRootController:Password];

}
@end
